package com.login;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.Toast;

import com.test.R;
import com.test.StageListActivity;
import com.utils.Downloader;

public class ConfigurationActivity extends Activity {

	private Downloader downloader;
	private boolean internetStatus=false;
	private String url;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		 
		setContentView(R.layout.configuration);
		System.out.println(internetStatus);
		url="http://10.4.133.20/stage/index.php";
		downloader=new Downloader();
        internetStatus=downloader.ifConfigure(url);
		if(internetStatus)
		{
			System.out.println("http connection failed....");
			setContentView(R.layout.configuration);	
			Toast message = Toast.makeText(ConfigurationActivity.this,
					R.string.configuration_error, Toast.LENGTH_SHORT);
			message.setGravity(Gravity.CENTER,
					message.getXOffset() / 2, message.getYOffset() / 2);
			message.show();
		}
		else
		{
			      System.out.println("http connection succeed....");
			      setContentView(R.layout.configuration);	
                  Intent intent = new Intent(ConfigurationActivity.this,StageListActivity.class);
					startActivity(intent);					
		}
			}

}
